﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Intorise.Framework;
using Intorise.Net;
using System.Net;
using Intorise.Common;
using System.Text;
using System.Data;

namespace TestWindowsFormsApplication
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //Test3(); return;
            //Test2(); return;
            //Test1(); return;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Lu());
            Application.Run(new Form1());
        }

        static void Test0()
        {
            NetTools tools = new NetTools();
            CookieContainer container = new CookieContainer();
            var request = tools.SendRequest("https://tw.battle.net/account/support/identify-account.html?requestType=PASSWORD_RESET", "GET", container);
            var html = tools.GetResponseHtmlGzip((HttpWebResponse)request.GetResponse());
            ConsoleBLL.WriteLine(html);
            request = tools.SendRequest("https://tw.battle.net/account/support/identify-account.html?requestType=PASSWORD_RESET", "POST", container);
            request.CookieContainer = container;
            tools.PostData("email=323194659@qq.com&csrftoken=5266ba8e-8c03-4e51-9a35-c5a35ae9fc5a", request);
            html = tools.GetResponseHtmlGzip((HttpWebResponse)request.GetResponse());
            ConsoleBLL.WriteLineInfo(html);
            Console.ReadLine();
        }

        static void Test1()
        {
            WebClient client = new WebClient();
            var html = client.DownloadString("https://tw.battle.net/account/support/identify-account.html?requestType=PASSWORD_RESET");
            ConsoleBLL.WriteLine(html);
            var data = client.UploadData("https://tw.battle.net/account/support/identify-account.html", Encoding.ASCII.GetBytes("csrftoken=bf31cdcf-4e75-4cc6-8059-79c4b7f9d087&email=zl201000@126.com"));
            html = Encoding.UTF8.GetString(data);
            ConsoleBLL.WriteLine(html);
            Console.ReadLine();
        }

        static void Test2()
        {
            var table = OfficeTools.GetDataTableFromExcel("f:\\soft\\a.xls", "[划款审单下载$]");
            foreach (DataRow row in table.Rows)
            {
                foreach (DataColumn col in table.Columns)
                {
                    Console.Write(row[col] + "\t");
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }

        static void Test3()
        {
            Adsl adsl = new Adsl();
            adsl.RouterDisconnect();
            Console.ReadLine();
            adsl.RouterConnect();
            Console.ReadLine();
        }
    }
}
